unit ToolLib_TLB;

// ************************************************************************ //
// WARNING                                                                    
// -------                                                                    
// The types declared in this file were generated from data read from a       
// Type Library. If this type library is explicitly or indirectly (via        
// another type library referring to this type library) re-imported, or the   
// 'Refresh' command of the Type Library Editor activated while editing the   
// Type Library, the contents of this file will be regenerated and all        
// manual modifications will be lost.                                         
// ************************************************************************ //

// PASTLWTR : $Revision:   1.88  $
// File generated on 1/31/96 4:33:54 PM from Type Library described below.

//***********************************************************************//
// NOTE:                                                                      
// Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used 
// by properties  
// which return objects that may need to be explicitly created via a function 
// call prior to any access via the property. These items have been disabled  
// in order to prevent accidental use from within the object inspector. You   
// may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or 
// by selectively   
// removing them from the $IFDEF blocks. However, such items must still be    
// programmatically created via a method of the appropriate CoClass before    
// they can be used.                                                          
// ************************************************************************ //
// Type Lib: C:\Program Files\Borland\Delphi5\Projects\ToolLib.tlb (1)
// IID\LCID: {6FA19D27-5BE3-11CF-9D30-A2CA128FCF06}\0
// Helpfile: 
// DepndLst: 
//   (1) v2.0 stdole, (C:\WINDOWS\SYSTEM\STDOLE2.TLB)
//   (2) v4.0 StdVCL, (C:\WINDOWS\SYSTEM\STDVCL40.DLL)
// ************************************************************************ //


// Unit must be compiled without type-checked pointers. 
{$TYPEDADDRESS OFF} 

interface

uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL;

// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:        
//   Type Libraries     : LIBID_xxxx                                      
//   CoClasses          : CLASS_xxxx                                      
//   DISPInterfaces     : DIID_xxxx                                       
//   Non-DISP interfaces: IID_xxxx                                        
// *********************************************************************//
const
  // TypeLibrary Major and minor versions
  ToolLibMajorVersion = 1;
  ToolLibMinorVersion = 0;

  LIBID_ToolLib: TGUID = 
            '{6FA19D27-5BE3-11CF-9D30-A2CA128FCF06}';

  IID_ITimerQuestion: TGUID = 
            '{6FA19D28-5BE3-11CF-9D30-A2CA128FCF06}';

  CLASS_TimerQuestion: TGUID = 
            '{6FA19D2A-5BE3-11CF-9D30-A2CA128FCF06}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary                    
// *********************************************************************//
  ITimerQuestion = interface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library                       
// (NOTE: Here we map each CoClass to its Default Interface)              
// *********************************************************************//
  TimerQuestion = ITimerQuestion;


// *********************************************************************//
// Interface: ITimerQuestion
// Flags:     (256) OleAutomation
// GUID:      {6FA19D28-5BE3-11CF-9D30-A2CA128FCF06}
// *********************************************************************//
  ITimerQuestion = interface(IUnknown)
    ['{6FA19D28-5BE3-11CF-9D30-A2CA128FCF06}']
    function  GetTime: WideString; stdcall;
  end;

// *********************************************************************//
// The Class CoTimerQuestion provides a Create and CreateRemote method to          
// create instances of the default interface ITimerQuestion exposed by              
// the CoClass TimerQuestion. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  CoTimerQuestion = class
    class function Create: ITimerQuestion;
    class function CreateRemote(const MachineName: 
                                                     string): ITimerQuestion;
  end;


// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object    : TTimerQuestion
// Help String      : TimerQuestion Object
// Default Interface: ITimerQuestion
// Def. Intf. DISP? : No
// Event   Interface: 
// TypeFlags        : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  TTimerQuestionProperties= class;
{$ENDIF}
  TTimerQuestion = class(TOleServer)
  private
    FIntf:        ITimerQuestion;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    FProps:       TTimerQuestionProperties;
    function      GetServerProperties: TTimerQuestionProperties;
{$ENDIF}
    function      GetDefaultInterface: ITimerQuestion;
  protected
    procedure InitServerData; override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor  Destroy; override;
    procedure Connect; override;
    procedure ConnectTo(svrIntf: ITimerQuestion);
    procedure Disconnect; override;
    function  GetTime: WideString;
    property  DefaultInterface: ITimerQuestion read GetDefaultInterface;
  published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
    property Server: TTimerQuestionProperties read GetServerProperties;
{$ENDIF}
  end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object    : TTimerQuestion
// (This object is used by the IDE's Property Inspector to allow editing
//  of the properties of this server)
// *********************************************************************//
 TTimerQuestionProperties = class(TPersistent)
  private
    FServer:    TTimerQuestion;
    function    GetDefaultInterface: ITimerQuestion;
    constructor Create(AServer: TTimerQuestion);
  protected
  public
    property DefaultInterface: ITimerQuestion read GetDefaultInterface;
  published
  end;
{$ENDIF}


procedure Register;

implementation

uses ComObj;

class function CoTimerQuestion.Create: ITimerQuestion;
begin
  Result := CreateComObject(CLASS_TimerQuestion) as ITimerQuestion;
end;

class function CoTimerQuestion.CreateRemote(const MachineName: string): ITimerQuestion;
begin
  Result := CreateRemoteComObject(MachineName, 
                            CLASS_TimerQuestion) as ITimerQuestion;
end;

procedure TTimerQuestion.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{6FA19D2A-5BE3-11CF-9D30-A2CA128FCF06}';
    IntfIID:   '{6FA19D28-5BE3-11CF-9D30-A2CA128FCF06}';
    EventIID:  '';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TTimerQuestion.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    Fintf:= punk as ITimerQuestion;
  end;
end;

procedure TTimerQuestion.ConnectTo(svrIntf: ITimerQuestion);
begin
  Disconnect;
  FIntf := svrIntf;
end;

procedure TTimerQuestion.DisConnect;
begin
  if Fintf <> nil then
  begin
    FIntf := nil;
  end;
end;

function TTimerQuestion.GetDefaultInterface: ITimerQuestion;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TTimerQuestion.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TTimerQuestionProperties.Create(Self);
{$ENDIF}
end;

destructor TTimerQuestion.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TTimerQuestion.GetServerProperties: TTimerQuestionProperties;
begin
  Result := FProps;
end;
{$ENDIF}

function  TTimerQuestion.GetTime: WideString;
begin
  Result := DefaultInterface.GetTime;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TTimerQuestionProperties.Create(AServer: TTimerQuestion);
begin
  inherited Create;
  FServer := AServer;
end;

function TTimerQuestionProperties.GetDefaultInterface: ITimerQuestion;
begin
  Result := FServer.DefaultInterface;
end;

{$ENDIF}

procedure Register;
begin
  RegisterComponents('Servers',[TTimerQuestion]);
end;

end.
